<template>
  <view :style="themeColor">
    <view class="page">
      <view class="flex benben-position-layout flex flex-wrap align-center xianxiashop_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub xianxiashop_fd0_0'>
          <view class='flex flex-wrap align-center xianxiashop_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
            data-url="1">
            <text class='fu-iconfont2  xianxiashop_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
            <text class='xianxiashop_fd0_0_c1_c0'>线下门店</text>
          </view>
          <view class='flex flex-wrap align-center justify-end xianxiashop_fd0_0_c0'>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <!---flex布局flex布局开始-->
      <view class="flex benben-flex-layout flex-wrap align-center xianxiashop_flex_1">
        <view class='flex flex-wrap align-center xianxiashop_fd1_0' @tap.stop="handleJumpDiy" data-type="navigateTo"
          :data-url="`/pages/tabBar/home/choosecity`">
          <text>{{cityname || '未知'}}</text>
          <image class='xianxiashop_fd1_0_c1' mode="aspectFit" :src='STATIC_URL+"503.png"'></image>
        </view>
        <view class='flex flex-wrap align-center xianxiashop_fd1_1' @tap.stop="handleJumpDiy" data-type="navigateTo"
          :data-url="`/`">
          <image class='xianxiashop_fd1_1_c0' mode="aspectFit" :src='STATIC_URL+"538.png"'></image>
          <input type="text" placeholder="请搜索你想要的商品" class="xianxiashop_fd1_1_c1" v-model="keyword"
            @confirm="getListFunc()">
          <!-- <text class='xianxiashop_fd1_1_c1'>请搜索你想要的商品</text> -->
        </view>
      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction align-stretch benben-flex-layout xianxiashop_flex_2">
        <template v-for='(item,key0) in storList'>
          <view class='flex flex-direction flex-wrap align-stretch xianxiashop_fd2_0' :key='key0'
            @tap.stop="handleJumpDiy" data-type="navigateTo"
            :data-url="`/pages/sy/shopdetail/shopdetail?usermerchant_aid=${item.id}`">
            <view class='flex flex-direction align-stretch'>
              <view class='flex align-stretch'>
                <image class='xianxiashop_fd2_0_c0_c0_c0' mode="aspectFill" :src='item.coverPic'></image>
                <view class='flex flex-direction align-stretch flex-sub xianxiashop_fd2_0_c0_c0_c1'>
                  <text class='xianxiashop_fd2_0_c0_c0_c1_c0'>{{item.shopName}}</text>
                  <view class='flex flex-direction flex-wrap align-stretch xianxiashop_fd2_0_c0_c0_c1_c1'>
                    <view class='flex flex-wrap align-center'>
                      <text>电话</text>
                      <text class='xianxiashop_fd2_0_c0_c0_c1_c1_c0_c1'>{{item.shopPhone}}</text>
                    </view>
                    <view class='flex align-stretch'>
                      <view class='xianxiashop_fd2_0_c0_c0_c1_c1_c1_c0'>位置</view>
                      <view class='text-cut-2 xianxiashop_fd2_0_c0_c0_c1_c1_c1_c1'>{{item.address}}</view>
                    </view>
                  </view>
                </view>
                <view class='flex flex-direction align-stretch justify-between' @tap.stop="handleJumpDiy"
                  data-type="navigateTo" :data-url="`/pages/sy/shopdetail/shopdetail?usermerchant_aid=${item.id}`">
                  <view class='flex flex-wrap align-start margin-top-xs' v-if=" item.distance!=0">
                    <text class='xianxiashop_fd2_0_c0_c0_c2_c0_c0'>{{item.distance}}</text>
                    <text class='xianxiashop_fd2_0_c0_c0_c2_c0_c0'>km</text>
                  </view>
                  <view class='flex flex-direction align-center' @click.stop="goMap(item)">
                    <image class='xianxiashop_fd2_0_c0_c0_c2_c1_c0' mode="aspectFit" :src='STATIC_URL+"512.png"'>
                    </image>
                    <text class='xianxiashop_fd2_0_c0_c0_c2_c1_c1'>导航</text>
                  </view>
                </view>
              </view>
            </view>
          </view>
        </template>

      </view>

      <!---flex布局flex布局结束-->
      <fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
        :listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>

    </view>
  </view>
</template>
<script>
  import pagingList from '@/common/mixin/paging_list.js';
  export default {
    components: {},
    mixins: [pagingList],

    data() {
      return {
        "storList": [],
        cityname: '',
        "minixPagingListsApi": "",
        "pageingListApiMethod": "",
        "allowOnloadGetList": false,
        keyword: '',
        lat: '',
        lng: '',
        cityinfo: ''
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      this.cityname = options.city
      this.lat = options.lat
      this.lng = options.lng
      this.getListFunc()
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {
      let that = this
      if (uni.getStorageSync('cityinfo')) {
        that.cityinfo = JSON.parse(uni.getStorageSync('cityinfo'))
        that.lat = that.cityinfo.lat
        that.lng = that.cityinfo.lng
        that.cityname = that.cityinfo.text
        console.log('that.citycode', that.region_code)
        this.getListFunc()
      }
    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      goMap(item) {
        uni.openLocation({
          latitude: parseFloat(item.latitude),
          longitude: parseFloat(item.longitude),
          name: item.shopName,
          success: function() {
            console.log('success');
          }
        });
      },
      getListFunc() {
        // 收藏的商品
        this.minixPagingListsApi = global.apiUrls.qrySearchShopItem;
        this.pageingListApiMethod = 'get';
        this.allowOnloadGetList = false;
        this.pagingListPostDataContent = {
          searchName: this.keyword,
          city: this.cityname,
          latitude: this.lat,
          longitude: this.lng
        }
        this.listData = [];
        this.storList = this.listData;
        this.pagingListToggle();

      },
      pagingListPostData() {
        return this.pagingListPostDataContent
      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: #F8F8F8;
    background-size: 100% auto;
  }

  .xianxiashop_flex_0 {
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .xianxiashop_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 700;
    color: #333333;
    line-height: 50rpx;
  }

  .xianxiashop_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
  }

  .xianxiashop_fd0_0_c0 {
    width: 120rpx;
  }

  .xianxiashop_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .xianxiashop_flex_1 {
    background: var(--benbenbgColor1);
    background-size: 100% auto;
    height: 100rpx;
  }

  .xianxiashop_fd1_1_c1 {
    margin: 0rpx 0rpx 0rpx 24rpx;
    font-size: 24rpx;
    font-weight: 400;
    color: rgba(153, 153, 153, 1);
  }

  .xianxiashop_fd1_1_c0 {
    width: 32rpx;
    height: 32rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .xianxiashop_fd1_1 {
    background: rgba(245, 245, 245, 1);
    width: 500rpx;
    height: 64rpx;
    border-radius: 45rpx 45rpx 45rpx 45rpx;
    background-size: 100% auto !important;
    padding: 0rpx 32rpx 0rpx 32rpx;
    margin: 0rpx 32rpx 0rpx 32rpx;
  }

  .xianxiashop_fd1_0_c1 {
    width: 35rpx;
    height: 37rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 0rpx 0rpx 12rpx;
  }

  .xianxiashop_fd1_0 {
    margin: 0rpx 0rpx 0rpx 32rpx;
  }

  .xianxiashop_flex_2 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .xianxiashop_fd2_0_c0_c0_c2_c1_c1 {
    font-size: 24rpx;
    color: var(--benbenFontColor4);
  }

  .xianxiashop_fd2_0_c0_c0_c2_c1_c0 {
    width: 33rpx;
    height: 33rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .xianxiashop_fd2_0_c0_c0_c2_c0_c0 {
    color: var(--benbenFontColor6);
    font-size: 22rpx;
  }

  .xianxiashop_fd2_0_c0_c0_c1_c1_c1_c1 {
    margin: 0rpx 0rpx 0rpx 24rpx;
    max-width: 200rpx;
  }

  .xianxiashop_fd2_0_c0_c0_c1_c1_c1_c0 {
    width: 60rpx;
  }

  .xianxiashop_fd2_0_c0_c0_c1_c1_c0_c1 {
    margin: 0rpx 0rpx 0rpx 24rpx;
  }

  .xianxiashop_fd2_0_c0_c0_c1_c1 {
    color: var(--benbenFontColor2);
  }

  .xianxiashop_fd2_0_c0_c0_c1_c0 {
    color: var(--benbenFontColor0);
    font-size: 32rpx;
    font-weight: 700;
    margin: 0rpx 0rpx auto 0rpx;
  }

  .xianxiashop_fd2_0_c0_c0_c1 {
    margin: 0rpx 16rpx 0rpx 16rpx;
  }

  .xianxiashop_fd2_0_c0_c0_c0 {
    width: 184rpx;
    height: 184rpx;
    border-radius: 8rpx;
  }

  .xianxiashop_fd2_0 {
    background: var(--benbenbgColor1);
    background-size: 100% auto !important;
    margin: 20rpx 0rpx 0rpx 0rpx;
    padding: 32rpx 24rpx 32rpx 24rpx;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
  }
</style>
